﻿using System.Web;
using System.Web.Security;


namespace Enterprise
{
    /// <summary>
    /// 管理员
    /// </summary>
    public class AdminBasePage : BasePage
    {
        public string Auth = HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName] == null
                         ? string.Empty
                         : HttpContext.Current.Request.Cookies[FormsAuthentication.FormsCookieName].Value;
        public string Aspsessid { get { return HttpContext.Current.Session.SessionID; } }
        public string CurrentUserName { get { return HttpContext.Current.User.Identity.Name; } }
        public AdminBasePage()
        {
            if (!HttpContext.Current.User.Identity.IsAuthenticated)
            {
                if (IsAjaxRequest)
                {
                    
                    Json(new { state = false, message = "登入失效，请重新登入！" });
                }
                else
                {
               
                    FormsAuthentication.RedirectToLoginPage();
                    HttpContext.Current.Response.End();
                }
            }
        }

    }

}
